package cate.game.train.hero.msg;

import cate.common.annotation.OperationSetter;
import cate.common.table.d.GDOperation;
import cate.common.util.GameResult;
import cate.game.GameBody;
import cate.game.client.ClientContext;
import cate.game.client.msg.ClientMsg;
import cate.game.client.msg.MsgConfig;
import cate.game.client.msg.MsgInput;
import cate.game.client.msg.id.MsgIdBTrain;
import cate.game.role.bag.hero.Hero;
import easy.java.dev.note.NoteField;

@ClientMsg(title = "英雄升阶の 请求")
@OperationSetter(GDOperation.HERO_GRADE_UP)
public class HeroGradeUpReq implements MsgInput {
    @NoteField(value = "英雄唯一ID")
    public String uid;

    @Override
    public void execute(GameBody game, ClientContext cc) {
        GameResult<Hero> r = cc.getRole().getGame().train.hero.gradeUp(cc.getRole(),uid);
        if(!r.ok()){
            game.notice.message(cc.getRole(), r.message);
        }
    }

    @Override
    public MsgConfig conf() {
        return MsgIdBTrain.HERO_GRADE_UP_REQ;
    }
}
